<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

<head>
    <title>微信扫码支付</title>
    <div data-th-replace="layout/head"></div>
</head>
<body>
    <div data-th-replace="layout/common-hade-order"></div>
    <div class="mb20 pb10">
        <div class="container">
            <div class="cm-wbg__bx">
                <article class="mt20 mr20 mb20 ml20">
                    <div class="mt20 pt10 text-center">
                        <span class="fs18">微信扫一扫，快捷支付 </span>
                    </div>
                    <div class="wxBuy__wrap" th:style="'background-image: url('+${staticPath}+'/front/web/v3/img/f-pay/wxTips-tz.jpg)'">
                        <div class="QRcode-wx" id="qrcode">
                        </div>
                        <div class="wxFoot__wrap"></div>
                    </div>
                </article>
            </div>
        </div>
    </div>
    <div data-th-replace="layout/footer"></div>
    <script type="text/javascript" th:src="@{{path}/common/qrcode/jquery.qrcode.min.js?v={v}(path=${staticPath}, v=${v})}"></script>

    <script th:inline="javascript" type="text/javascript">
        var link = [[${resultMap['entity']}]];
        var orderNo = [[${orderNo}]];
        $(document).ready(function(){
            $("#pay-page-body").show();
            $("#pay-page-body").css("min-height","0px");
            try{
                document.createElement('canvas').getContext('2d');
                $('#qrcode').qrcode({render:"canvas",height:200, width:200,correctLevel:0,text:link});
            }catch (e){
                $('#qrcode').qrcoverificationOrderStatusde({render:"table",height:200, width:200,correctLevel:0,text:link});
            }
            setInterval(reviewTrxOrder,10000);
            
            function reviewTrxOrder() {
                $.ajax({
                    url: baseloaction +'/web/uc/pay/verificationOrderStatus',
                    type:'post',
                    dataType:'json',
                    data:{'orderNo':orderNo},
                    success:function (result) {
                        if(result.success==true && result.entity=='SUCCESS'){
                            window.location.href = baseloaction +'/web/uc/order/list';
                        }
                    },
                    error:function (error) {
                        console.info("-----------系统错误，验证订单失败")
                    }
                });
            }
        });
    </script>
</body>
</html>
